package com.example.jpatest.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * 老师实体类
 * @author czx
 */

@Entity
@Data
@ToString(exclude = {"teamTeachers"})
@EqualsAndHashCode(exclude = {"teamTeachers"})
public class Teacher {

    /**
     * 工号
     */
    @Id
    private Long id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 电话号码
     */
    private String phoneNumber;

    /**
     * 邮箱地址
     */
    private String email;

    /**
     * 与队伍的联系
     */
    @OneToMany(mappedBy = "teacher",cascade = {CascadeType.MERGE,CascadeType.PERSIST})
    @JsonIgnore
    private Set<TeamTeacher> teamTeachers = new HashSet<>();
}
